package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.controller.BaseController;
import com.spzx.product.api.domain.SkuLockVo;
import com.spzx.product.api.factory.RemoteSkuStockFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(
        contextId = "remoteSkuStockService",
        value = ServiceNameConstants.PRODUCT_SERVICE,
        fallbackFactory = RemoteSkuStockFallbackFactory.class
)
public interface RemoteSkuStockService {
        @Operation(summary = "检查与锁定库存")
        @PostMapping("/skuStock/checkAndLock/{orderNo}")
        public R<String> checkAndLock(@PathVariable("orderNo") String orderNo,
                                      @RequestBody List<SkuLockVo> skuLockVoList,
                                      @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
